import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.junit.Test;

import javax.naming.Name;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;

public class XmlParse {


    @Test
    public void test3() throws DocumentException {
        SAXReader reader = new SAXReader();
        Document document = reader.read(new File("src/收藏信息.xml"));
        Element rootElm = document.getRootElement();
        Iterator iterator = rootElm.attributeIterator();
        while (iterator.hasNext()){
            Attribute attribute = (Attribute) iterator.next();
            System.out.println(attribute.getText());
        }
    }
}
